newsitemdetaile();
function newsitemdetaile(){
	var id = getQueryString('id');
	$(".newscontents").html("");
	if(id){
		$.ajax({
	    	url:URL+'Home/Newsdetaili/newsitemdetaile',
	    	type:'GET',
	    	data:{id:id},
	    	success:function(data){
	    		console.log(data);
	    		$.each(data.newsitemdetaile,function(indexs,obj){
	    			if(obj!=""){
	    				console.log(obj);
						var htmlcontent="",
				 		   title=obj.title,
				 		   newcontent=obj.newcontent,
				 		   author=obj.author,
				 		   browse=obj.browse,
				 		   source=obj.source,
				 		   time=obj.time,
				 		   type=obj.type,
				 		   title1=obj.title1,
				 		   newcontent1=obj.newcontent1,
				 		   title2=obj.title2,
				 		   newcontent2=obj.newcontent2,
				 		   title3=obj.title3,
				 		   newcontent3=obj.newcontent3;
				 		   htmlcontent+=`
			                    <div class="new-titles">
				                   <p>${title}</p>
				                   <div class="new-release">
				                       <span>来源：${source}</span>
				                       <b></b>
				                       <span>作者：${author}</span>
				                       <b></b>
				                       <span>发布时间：${time}</span>
				                       <b></b>
				                       <span>${browse}次浏览</span>
				                   </div>
				               </div>
				                <div class="new-contents">
				                    <p class="text_in">${newcontent}</p>
				                    <p>${title1}</p>
				                    <p class="text_in">${newcontent1}</p>
				                    <p>${title2}</p>
				                    <p class="text_in">${newcontent2}</p>
				                    <p>${title3}</p>
				                    <p class="text_in">${newcontent3}</p>
				                </div>
				               `;	
				            $(".newscontents").html(htmlcontent);
				        }else{
	    	    	        return;
	    	        }
		        })   	    
	    	},
	    	error:function(){}
	    })
	}
    
}

function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    var q = window.location.pathname.substr(1).match(reg_rewrite);
    if(r != null){
        return unescape(r[2]);
    }else if(q != null){
        return unescape(q[2]);
    }else{
        return null;
    }
}
